package com.community.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.community.entity.Article;
import com.community.service.IArticleService;

@Controller
@RequestMapping
public class IndexController {
	
	@Autowired
	private IArticleService iArticleService;
	
	@RequestMapping()
	public String index(ModelMap modelMap){
		
		//获取首页4条热门文章（点击量最多的文章）
		List<Article> articleList = iArticleService.getArticleToClickNumByLimit(4);
		modelMap.addAttribute("articleList", articleList);
		return "/index/index";
		
	}

}
